package ink.lovejinhu.base;

import java.util.Scanner;
import java.util.Stack;

/**
 * @author jinhu
 * created 2021-06-29 16:26
 */
public class Xiaomi01 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        Xiaomi01 xiaomi01 = new Xiaomi01();
       if (xiaomi01.isValid(s)){
           System.out.println("YES");
       }
       else {
           System.out.println("NO");
       }
    }
    public boolean isValid(String s){
        char[] chars = s.toCharArray();
        if (chars.length%2!=0)return false;
        for (int i = 0; i < chars.length; i++) {
            if ( !(chars[i]=='('||chars[i]==')')){
                return false;
            }

        }
        /**
         * (   0
         * )   1
         */
        Stack<Character> characters = new Stack<>();
        for (int i = 0; i < chars.length; i++) {
            if (characters.isEmpty()){ //是空
                characters.push(chars[i]);
                continue;
            }
            if (characters.peek()!=chars[i]){  //栈顶和这个元素不相等
                characters.pop();
            }else {
                characters.push(chars[i]);
            }

        }
        return characters.isEmpty();

    }
}
